#pragma once
#include <workflow/ProtocolMessage.h>
#include <frpc/frpc.h>
#include <frpc/router.h>
#include <workflow/Workflow.h>

namespace Frpc{
    class ServerTask;
    class Context{//for every connection
        public:
        int64_t user_id=-1;
		ServerTask* task=nullptr;
        std::string sec_salt;
       // bool valid(){return user_id==-1;}
        //void set_sec_key(std::string_view&& s){sec_salt=s;}
        ~Context(){user_id=-1;}
    };
    class ServerCtx{//for every connection
        public:
        int64_t user_id=-1;
		SeriesWork* work=nullptr;
        std::string sec_salt;
        bool valid(){return user_id==-1;}
        //void set_sec_key(std::string_view&& s){sec_salt=s;}
        ~ServerCtx(){user_id=-1;}
    };
class MsgIO : public protocol::ProtocolMessage,public Frpc::Msg
{
private:

	virtual int encode(struct iovec vectors[], int max);
	virtual int append(const void *buf, size_t *size);
public:

};
class RequestMsg : public MsgIO{
static uint16_t _seq;
public:
RequestMsg(){head()->request_seq=_seq++;}

};

class ReplyMsg : public MsgIO
{
public:


};


}